/* ----------------------------------------------------------------------------
* File: quiz_statistic.h
*
* Desc: Quiz statistic
*
* Created: 05/08/2011, by Alexey Korshunov
* ---------------------------------------------------------------------------- */
#ifndef _QUIZ_STATISTIC_H_
#define _QUIZ_STATISTIC_H_

#include "user_profile.h"

namespace QuizCore
{
	struct StatisticInfo
	{
		StatisticInfo()
			: processedQuestions(0)
			, correctAnswers(0) 
		{
		}

		UserStatisticList userStats;
		unsigned int processedQuestions;
		unsigned int correctAnswers;
	};

	class StatisticProvider
	{
	public:
		explicit StatisticProvider(const UserProfileManager* manager);

		void IncrementCountQuestions();
		void IncrementCorrectAnswers();
		Common::Error AddPointsToUser(const std::string& User, unsigned int Points);
		const StatisticInfo& GetStatisticInfo() const;

	private:
		void ReadUserStatisticInfo();

		StatisticInfo m_StatInfo;
		UserProfileManager* m_UserProfileManager;
	};
}

#endif // _QUIZ_STATISTIC_H_